package com.ruoyi.web.controller.system;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.system.domain.MeetingManagement;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.MeetingSummary;
import com.ruoyi.system.service.IMeetingSummaryService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 会议纪要Controller
 *
 * @author ruoyi
 * @date 2024-04-03
 */
@RestController
@RequestMapping("/system/summary")
public class MeetingSummaryController extends BaseController
{
    @Autowired
    private IMeetingSummaryService meetingSummaryService;

    /**
     * 查询会议纪要列表
     */
    @PreAuthorize("@ss.hasPermi('system:summary:list')")
    @PostMapping("/list")
    public TableDataInfo list(@RequestBody MeetingManagement meetingManagement)
    {
        setStartPage(meetingManagement.getPageNum(),meetingManagement.getPageSize());
        List<MeetingManagement> list = meetingSummaryService.getMeetingSummaryList(meetingManagement);
        return getDataTable(list);
    }

    /**
     * 获取会议纪要详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:summary:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(meetingSummaryService.selectMeetingSummaryById(id));
    }

    /**
     * 新增会议纪要
     */
    @PreAuthorize("@ss.hasPermi('system:summary:add')")
    @Log(title = "会议纪要", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody MeetingSummary meetingSummary)
    {
        return toAjax(meetingSummaryService.insertMeetingSummary(meetingSummary));
    }

    /**
     * 修改会议纪要
     */
    @PreAuthorize("@ss.hasPermi('system:summary:edit')")
    @Log(title = "会议纪要", businessType = BusinessType.UPDATE)
    @PutMapping("/edit")
    public AjaxResult edit(@RequestBody MeetingSummary meetingSummary)
    {
        return toAjax(meetingSummaryService.updateMeetingSummary(meetingSummary));
    }

    /**
     * 删除会议纪要
     */
    @PreAuthorize("@ss.hasPermi('system:summary:remove')")
    @Log(title = "会议纪要", businessType = BusinessType.DELETE)
	@DeleteMapping("/{id}")
    public AjaxResult remove(@PathVariable Long id)
    {
        return toAjax(meetingSummaryService.deleteMeetingSummaryById(id));
    }
}
